The escape sequences are special character that understand by the python interpreter then displayed the result in some way . the escape sequences is also called backslash sequences. The escape sequences are used before the backward slash followed by the escape characters .
The python provides the more Escape sequences That is in the below
Escape sequences | Description | Example | Output |
---|---|---|---|
|
it is used to break the line and print the result as new line | print("Drashan is a web developer \n That is good") | Drashan is a web developer That is good |
|
it is used to space between elements and print the result as some space. this is horizontal tab | print("5\t2") | 5 2 |
|
it is used to insert a backslash into string | print("Darshan\\coder") | Darshan\ coder |
|
it is used to insert a double or single quotes into string | print("Hello \"Coders") | Hello" coders |
|
it is denoted the ASCII Carriage Return(CR) character,which resets the cursor to the beginning of the line | print("Hello,\rworld ") | world |
|
Denoted the ASCII Form feed Character, which originally represented the start of a new page in printers | print("Hello \f"Coders") | Hello Coders |